package model.world;

//import model.csExceptions.NotEnoughGrenades;
import java.io.Serializable;

import model.csExceptions.TooMuchGrenades;



/**
 * This class implements the stuff a player can
 * have.
 * 
 * @author Urbanek Lucas (aka NaG)
 */
public class CSStuff implements Serializable {
	private int fb;
	private int he;
	private int sg;
	
	public int getFBs() {
		return fb;
	}
	
	public int getHEs() {
		return he;
	}
	
	public int getSGs() {
		return sg;
	}
	
	public void setFBs(int n) {
		fb = Math.min(2, n);
		fb = Math.max(fb, 0);
	}
	
	public void setHEs(int n) {
		he = Math.min(1, n);
		he = Math.max(he, 0);
	}
	
	public void setSGs(int n) {
		sg = Math.min(1, n);
		sg = Math.max(sg, 0);
	}
	
	public boolean canThrowFB(int count) {
		return count<2;
	}
	
	public boolean canThrowHE(int count) {
		return count<1;
	}
	
	public boolean canThrowSG(int count) {
		return count<1;
	}
	
	public void throwFB() { //throws NotEnoughGrenades {
//		if (!canThrowFB())
//			throw new NotEnoughGrenades();
		fb--;
	}
	
	public void throwHE() { //throws NotEnoughGrenades {
//		if (!canThrowHE())
//			throw new NotEnoughGrenades();
		he--;
	}
	
	public void throwSG() { //throws NotEnoughGrenades {
//		if (!canThrowSG())
//			throw new NotEnoughGrenades();
		sg--;
	}
	
	public void giveFB() throws TooMuchGrenades {
		if (fb==2)
			throw new TooMuchGrenades();
		fb++;
	}
	
	public void giveHE() throws TooMuchGrenades {
		if (he==1)
			throw new TooMuchGrenades();
		he++;
	}
	
	public void giveSG() throws TooMuchGrenades {
		if (sg==1)
			throw new TooMuchGrenades();
		sg++;
	}
}
